﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace Crude.Common
{
    [DataContract]
    public enum OutputFileCondition
    {
        [EnumMember]
        Debug = 1,
        [EnumMember]
        Release = 2,
        [EnumMember]
        Both = 3
    }

    [DataContract]
    public class OutputFile : IEquatable<OutputFile>
    {
        public OutputFile(string fileName, OutputFileCondition outputFileCondition)
        {
            FileName = fileName;
            OutputFileCondition = outputFileCondition;
        }

        [DataMember]
        public string FileName { get; set; }

        [DataMember]
        public OutputFileCondition OutputFileCondition { get; set; }

        public override int GetHashCode()
        {
            return FileName.GetHashCode() * 27 + OutputFileCondition.GetHashCode();
        }

        public override bool Equals(object obj)
        {
            return Equals(obj as OutputFile);
        }

        public bool Equals(OutputFile other)
        {
            if (other == null)
            {
                return false;
            }
            else if (!string.Equals(FileName, other.FileName))
            {
                return false;
            }
            else if (!string.Equals(OutputFileCondition, other.OutputFileCondition))
            {
                return false;
            }

            return true;
        }
    }
}
